/*
 * Title:        CloudScheduler Toolkit
 * Description:  a Toolkit for Modeling and Simulation of Job Scheduling and Resource Provisioning in Cloud System
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 * Author:       Fuhui Wu
 *
 * Copyright (c) 2013-2014, The National University of Defense Technology, China
 */

package org.nudt.jCloud.workload;

import java.util.ArrayList;
import java.util.List;

import org.nudt.jCloud.simulation.User;

public class Workload {
	private User user;
	private List<LogicalJob> logicalJobList;
	private int index = 0;
	
	private double thinkTimeOfJob = 0;
	private double thinkTimeOfTask = 0;

	public Workload() {
		setLogicalJobList(new ArrayList<LogicalJob>());
	}

	/*
	 * add a new XJob to xJobs list.
	 */
	public void add(LogicalJob xJob){
		logicalJobList.add(xJob);
		xJob.setId(index++);
	}
	
	public int size(){
		return logicalJobList.size();
	}
	
	public void reset() {
		for(int i=0; i<logicalJobList.size(); ++i){
			logicalJobList.get(i).reset();
		}
		
	}
	
	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public List<LogicalJob> getLogicalJobList() {
		return logicalJobList;
	}

	public void setLogicalJobList(List<LogicalJob> logicalJobList) {
		this.logicalJobList = logicalJobList;
	}

	public double getThinkTimeOfJob() {
		return thinkTimeOfJob;
	}

	public void setThinkTimeOfJob(double thinkTimeOfJob) {
		this.thinkTimeOfJob = thinkTimeOfJob;
	}

	public double getThinkTimeOfTask() {
		return thinkTimeOfTask;
	}

	public void setThinkTimeOfTask(double thinkTimeOfTask) {
		this.thinkTimeOfTask = thinkTimeOfTask;
	}
	
}
